/*
 * @Author: your name
 * @Date: 2020-08-17 10:53:41
 * @LastEditTime: 2020-08-17 14:04:49
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \PipeOneMap_WebClient\src\app\business\home\form-constor\form.service.ts
 */
import { Injectable } from '@angular/core';
// import { DropdownQuestion } from './question-dropdown';
import { FormBase } from './form-base';
// import { TextboxQuestion }  from './question-textbox';
import { of } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class FormService {

  // TODO: get from a remote source of question metadata
  getforms() {

    const forms: FormBase [] = [
      {
        fieldId: '001',
        label: 'Bravery Rating',
        type: 'select',
        readOnly: true,
        name: 'gender2',
        des: '212',
        options: [
          {label: 'solid',  val: 'Solid'},
          {label: 'great',  val: 'Great'},
          {label: 'good',   val: 'Good'},
          {label: 'unproven', val: 'Unproven'}
        ],
        order: 2,
        value: '全部',
      },
      {
        fieldId: '002',
        name: 'gender',
        label: 'First name',
        type: 'input',
        required: true,
        order: 1,
        value: '212',
      },
      {
        fieldId: '003',
        name: 'gender5',
        label: 'First name',
        type: 'input',
        required: true,
        order: 3,
        value: '212',
      }
    ];

    return forms.sort((a, b) => a.order - b.order);
  }
}
